$OpenBSD: patch-mapscript_php_owsrequest_c,v 1.1 2015/06/05 05:58:34 robert Exp $
--- mapscript/php/owsrequest.c.orig	Thu Jan  2 13:41:49 2014
+++ mapscript/php/owsrequest.c	Thu Jun  4 20:22:17 2015
@@ -32,6 +32,9 @@
 #include "php_mapscript.h"
 #include "SAPI.h"
 #include "php_variables.h"
+#if PHP_VERSION_ID >= 50600
+#include "php_streams.h"
+#endif
 
 char *owsrequest_getenv(const char *name, void *thread_context);
 
@@ -193,9 +196,29 @@ PHP_METHOD(OWSRequestObj, loadParams)
         cgirequestObj_loadParams(php_owsrequest->cgirequest, owsrequest_getenv, NULL, 0, thread_context);
       }
     } else {
+#if PHP_VERSION_ID >= 50600
+      php_stream *s = php_stream_temp_new();
+      php_stream *input = php_stream_open_wrapper("php://input", "r", 0, NULL);
+
+      /* php://input does not support stat */
+      php_stream_copy_to_stream_ex(input, s, -1, NULL);
+      php_stream_close(input);
+
+      php_stream_rewind(s);
+      
+      char *raw_post_data = NULL;
+      long raw_post_data_length = 0;
+
+      raw_post_data_length = php_stream_copy_to_mem(s, raw_post_data, -1, 0);
+
       cgirequestObj_loadParams(php_owsrequest->cgirequest, owsrequest_getenv,
+                               raw_post_data,
+                               raw_post_data_length, thread_context);
+#else
+      cgirequestObj_loadParams(php_owsrequest->cgirequest, owsrequest_getenv,
                                SG(request_info).raw_post_data,
                                SG(request_info).raw_post_data_length, thread_context);
+#endif
     }
   }
 
